package com.fengxing.ams.pub.util;

import org.apache.http.StatusLine;

import com.fengxing.ams.pub.AMSException;

/**
 * This class is used to handle the exceptions occurred while calling http client.
 */
public class HttpClientException extends AMSException {
    private static final long serialVersionUID = -5374456973547934589L;
    
    /**
     * The status returned from http response.
     */
    private StatusLine statusLine;
    /**
     * The content returned from http response.
     */
    private String content;

    /**
     * Create a new HttpClientException with the specified message.
     * @param msg the detail message
     */
    public HttpClientException(final String msg) {
        super(msg);
    }

    /**
     * Create a new HttpClientException with the specified message
     * and root cause.
     * @param msg the detail message
     * @param ex the root cause
     */
    public HttpClientException(final String msg, final Throwable ex) {
        super(msg, ex);
    }
    
    /**
     * Create a new HttpClientException with the specified message and status.
     * @param msg the detail message
     * @param statusLine the status object got from http response.
     * @param content the content returned from http response.
     */
    public HttpClientException(final String msg, final StatusLine statusLine, final String content) {
        super(msg);
        this.statusLine = statusLine;
        this.content = content;
    }

    /**
     * @return the statusLine
     */
    public StatusLine getStatusLine() {
        return statusLine;
    }

    /**
     * @return the content
     */
    public String getContent() {
        return content;
    }
}
